/*
 * CPLEXProblemGenerator.h
 *
 *  Created on: 04/giu/2013
 *      Author: Ialenti Andrea, Marangon Fabio
 */

#ifndef CPLEXPROBLEMGENERATOR_H_
#define CPLEXPROBLEMGENERATOR_H_

#include "StatusCodes.h"
#include "Types.h"

//	This function will create a correspondence between the graph edges and the problem 'Xe' variables.
Status createCorrespondences(const Config *cfg, Problem *p, const Graph *g, bool verbose);

//	Getter function to retrieve the two nodes indices (i, j) given the edge index 'Xe'.
void getEdgeNodes(const Problem *p, int XeIdx, int *i, int *j);

//	Getter function to retrieve the edge index 'Xe' given its two nodes (it uses binary search).
int getEdgeIndex(const Problem *p, int i, int j);

//	This function is used to create the initial problem from the graph (without SECs).
Status setProbData(const Config *cfg, Problem *p);

//	This function is used to create the initial proximity search problem from the graph.
Status setProxyProbData(const Config *cfg, Problem *psP, const double *x);

//	This function is used to create the initial CPLEX problem, without SECs, it can create the proximity search version too.
Status generateProb(const Config *cfg, CPXENVptr *env, CPXLPptr *lp, Problem *p, const Graph *g, double LB, double UB, bool useCB, bool verbose);

//	This function is used to create the initial CPLEX problem, without SECs, along with the proximity search version.
Status generateProxyProb(const Config *cfg, CPXENVptr *env, CPXLPptr *lp, CPXLPptr *psLP, Problem *p, Problem *psP, const Graph *g, double LB, double UB, const OneTree *tour, bool verbose);

#endif /* CPLEXPROBLEMGENERATOR_H_ */
